﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using GGJ_DKG.Objects;
using GGJ_DKG.Menu;
using GGJ_DKG.Managers;
namespace GGJ_DKG.Menu
{
    class Tutorial : Screen
    {
        Object2D bg0;
        Object2D bg1;
        Object2D pointer;
        float multiplier = 1;
        float screen = 1;
        public Tutorial(Texture2D texture, Vector2 position) :
            base(texture, position)
        {
        }
        public override void Load(ContentManager Content, GameWindow Window)
        {
            bg0 = new Object2D(Content.Load<Texture2D>("Menu/tuto01"));
            bg1 = new Object2D(Content.Load<Texture2D>("Menu/tuto02"));
            bg0.Position = new Vector2(Window.ClientBounds.Width / 2, Window.ClientBounds.Height / 2);
            bg1.Position = new Vector2(Window.ClientBounds.Width / 2, Window.ClientBounds.Height / 2);
            pointer = new Object2D(Content.Load<Texture2D>("Menu/tuto_SELETOR"));
            pointer.Position = new Vector2(Window.ClientBounds.Width / 2, Window.ClientBounds.Height / 2); ;
        }
        public override void Update(GameTime gameTime)
        {
            if (screen == 1)
            {
                pointer.Position = new Vector2((float)(Game1.Self.Window.ClientBounds.Width - (pointer.Texture.Width*2.5)),
                    (float)(pointer.Texture.Height * 1.59));
                if (Input.GetDown(Keys.Enter))
                {
                    multiplier = 1;
                    screen++;
                }
            }
            else
            {

                pointer.Position = new Vector2((float)(Game1.Self.Window.ClientBounds.Width - (pointer.Texture.Width*2.5)),
                    (float)((pointer.Texture.Height * 0.5)+(multiplier*pointer.Texture.Height)));
                if (Input.GetDown(Keys.Up) && multiplier > 1)
                {
                    multiplier-=2;
                }
                else if (Input.GetDown(Keys.Down) && multiplier < 3)
                {
                    multiplier+=2;
                }
                else if (Input.GetDown(Keys.Enter))
                {
                    switch ((int)multiplier)
                    {
                        case 1:
                            Game1.Self.currentScreenSelect = Game1.Screens.MENU;
                            break;
                        case 3:
                            screen--;
                            break;
                    }
                }
            }
        }
        public override void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            if (screen == 1) { bg0.Draw(spriteBatch); }
            else { bg1.Draw(spriteBatch); }
            pointer.Draw(spriteBatch);
        }
    }
}
